package com.xcity.pomelo.response;

import com.xcity.db.entity.Player;
import com.xcity.game.combat.attr.CombatAttribute;
import com.xcity.game.player.PlayerTrainService;
import com.xcity.game.player.template.DestinyTemplate;

import naga.x.net.impl.pomelo.PomeloMessage;
import naga.x.net.impl.pomelo.protocol.Message;
import naga.x.util.CommonUtils;
import naga.x.util.NumberUtils;

@PomeloMessage(type = Message.Type.RESPONSE)
public class DestinyLevelUpResponse extends AbstractDestinyResponse {
	
	// 升级后改变的属性
	public short[] attrsIndex = NumberUtils.EMPTY_SHORTS;
	public Object[] attrs = CommonUtils.EMPTY_OBJECT_ARRAY;
	
	public DestinyLevelUpResponse(int serial, Player player, DestinyTemplate used, PlayerTrainService service) {
		super(serial, player, service);
		CombatAttribute[] refers = used.getAttributes();
		this.attrsIndex = new short[refers.length];
		this.attrs = new Object[refers.length];
		for (int i = 0; i < refers.length; i++) {
			CombatAttribute refer = refers[i];
			this.attrsIndex[i] = (short) refer.getType().ordinal();
			this.attrs[i] = refer.format(player.getAttributeValue(refer.getType()));
		}
	}

}
